# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=phonon-vlc
pkgname=(phonon-qt5-vlc
         phonon-qt6-vlc)
pkgdesc='Phonon VLC backend'
pkgver=0.12.0
pkgrel=2
arch=(loong64 x86_64)
url='https://community.kde.org/Phonon'
license=(LGPL)
depends=(gcc-libs
         glibc
         vlc)
makedepends=(extra-cmake-modules
             phonon-qt5
             phonon-qt6
             qt5-tools
             qt6-tools)
source=(https://download.kde.org/stable/phonon/phonon-backend-vlc/$pkgver/phonon-backend-vlc-$pkgver.tar.xz{,.sig})
sha256sums=('338479dc451e4b94b3ca5b578def741dcf82f5c626a2807d36235be2dce7c9a5'
            'SKIP')
validpgpkeys=(CB9387521E1EE0127DA804843FDBB55084CC5D84  # Harald Sitter <sitter@kde.org>
              E0A3EB202F8E57528E13E72FD7574483BB57B18D) # Jonathan Esk-Riddell <jr@jriddell.org>

build() {
  cmake -B build5 -S phonon-backend-vlc-$pkgver \
    -DPHONON_BUILD_QT6=OFF
  cmake --build build5

  cmake -B build6 -S phonon-backend-vlc-$pkgver \
    -DPHONON_BUILD_QT5=OFF
  cmake --build build6
}

package_phonon-qt5-vlc() {
  pkgdesc+=' for Qt5'
  depends+=(phonon-qt5
            qt5-base)
  provides=(phonon-qt5-backend)

  DESTDIR="$pkgdir" cmake --install build5
}

package_phonon-qt6-vlc() {
  pkgdesc+=' for Qt6'
  depends+=(phonon-qt6
            qt6-base)
  provides=(phonon-qt6-backend)

  DESTDIR="$pkgdir" cmake --install build6
  rm -r "$pkgdir"/usr/share # Conflicts with qt5
}
